home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / nt / ntkb.zip / NTKB.EXE / Q106 / 2 / 53.TXT < prev   
Text File  |  1993-12-09  |  4KB  |  83 lines

  1. DOCUMENT:Q106253  08-DEC-1993  [W_NT]
  2. TITLE   :Program priority and Multithreaded applications.
  3. PRODUCT :Windows NT
  4. PROD/VER:3.10
  5. OPER/SYS:WINDOWS
  6. KEYWORDS:
  7.  
  8. --------------------------------------------------------------------
  9. The information in this article applies to:
  10.  - Microsoft Windows NT operating system version 3.1
  11.  - Microsoft Windows NT Advanced Server version 3.1
  12. --------------------------------------------------------------------
  13.  
  14. SUMMARY
  15. =======
  16.  
  17. When a program is started under Windows NT it will have a priority
  18. class that is either Normal or equal to the priority class specified
  19. in the command line when using the START command (Idle, Normal, High
  20. or Realtime). The priority class determines which priority (from 1 to
  21. 31) the program will run at. In a multithreaded application, threads
  22. spawned by the program can be lower or higher than the current
  23. priority class of the program; however all thread priorities will be
  24. relative to the priority class of the parent program. While a program
  25. can change itÆs priority class after starting, all of its threads will
  26. still have the same relative priority.
  27.  
  28. MORE INFORMATION
  29. ================
  30.  
  31. When a process spawns a thread, one of the parameters in the function
  32. call sets the thread priority relative to the priority of the parent
  33. process. This parameter can have one of the following values: Idle,
  34. Lowest, Below Normal, Normal, Above Normal, Highest and Time Critical.
  35. The starting priority set for the thread will be based upon that
  36. parameter and the current priority of the process starting the thread.
  37. The priorities are as follows:
  38.  
  39. RELATIVE                  PROCESS PRIORITY CLASS
  40. THREAD                Normal, in      Normal, in
  41. PRIORITY       Idle   Background      Foreground    High    Realtime
  42. -------------------------------------------------------------------
  43. Time Critical   15        15              15         15        31
  44. Highest          6         9              11         15        26
  45. Above Normal     5         8              10         14        25
  46. Normal           4         7               9         13        24
  47. Below Normal     3         6               8         12        23
  48. Lowest           2         5               7         11        22
  49. Idle             1         1               1          1        16
  50.  
  51. The table above lists the base priority of a thread which is set by
  52. calling the function SetThreadPriority, however a threadÆs priority
  53. can change as the thread executes. The system can boost a threadÆs
  54. priority higher as time goes on and then reduce the priority back down
  55. to the base, however Windows NT will never reduce a thread lower than
  56. itÆs base priority. The system will boost a threadÆs priority when a
  57. user interacts directly with a thread, including mouse and keyboard
  58. input or simply bringing the thread to the foreground.
  59.  
  60. For more information on process priorities, query on the following key
  61. words:
  62.  
  63. priority and process
  64.  
  65. Additional reference words: 1.00
  66. KBCategory:
  67. KBSubCategory: pertune
  68.  
  69. =============================================================================
  70.  
  71. THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS
  72. PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND.  MICROSOFT DISCLAIMS
  73. ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES
  74. OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  IN NO
  75. EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR
  76. ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL,
  77. CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF
  78. MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE
  79. POSSIBILITY OF SUCH DAMAGES.  SOME STATES DO NOT ALLOW THE EXCLUSION
  80. OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES
  81. SO THE FOREGOING LIMITATION MAY NOT APPLY.
  82.  
  83. Copyright Microsoft Corporation 1993.